package com.dotflat.fin.domain;

import com.dotflat.rest.domain.AreableObjectBase;
import com.matt.foundation.vo.ContractVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 *  账单对象
 */

@Data
@Entity
@Table(name="fin_pay_order", uniqueConstraints = {
        @UniqueConstraint(columnNames = {
                "areaId", "orderSn"
        })
})
@ApiModel("收费账单")
@EqualsAndHashCode(callSuper = true)
public class FinPlanOrder extends AreableObjectBase {

    @Column(columnDefinition = "VARCHAR(128) COMMENT '收款账号id'")
    private String payAccountIds;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '订单号'", nullable = false)
    @ApiModelProperty("订单号（账单号）")
    private String orderSn;

    //    账单单号：1100SFJH202111120400001               经手人：螺丝刀                 基本状态： 有效                支付状态：未支付                  发送状态：未发送               账单生成时间：2021-12-0
    @Column(columnDefinition = " bit(1) DEFAULT 0 COMMENT '作废' ", nullable = false)
    @ApiModelProperty("作废")
    private Boolean cancelled = false;

    @Column(columnDefinition = " bit(1) DEFAULT 0 COMMENT '是否已经推送家长' ", nullable = false)
    @ApiModelProperty("是否已经推送家长")
    private Boolean notified = false;

    @Column(columnDefinition = "varchar(32)  COMMENT '创建人名字（经手人）'", nullable = false)
    private String createdByName;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '计划名称'", nullable = false)
    @ApiModelProperty("计划名称")
    private String planName;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '计划Id'", nullable = false)
    @ApiModelProperty("计划Id")
    private String planId;

//    @Column(columnDefinition = "INT(3) default 0 COMMENT '计划类型, 0:日常  1:综合'")
//    private Integer planCategory = 0;

//    @Column(columnDefinition = "VARCHAR(32) COMMENT '班级名称'")
    @ApiModelProperty("班级名称")
    @Transient
    private String className;

//    @Column(columnDefinition = "VARCHAR(32) COMMENT '班级Id'", nullable = false)
//    @ApiModelProperty("班级Id")
//    private String classId;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '宝宝名称'")
    @ApiModelProperty("宝宝名称")
    private String childName;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '付款的合同'", nullable = false)
    @ApiModelProperty("付款的合同")
    private String contractId;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '客户id， 冗余'", nullable = false)
    @ApiModelProperty("客户id")
    private String clienteleId;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '账单标题'", nullable = false)
    @ApiModelProperty("账单标题")
    private String title;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '学期'")
    @ApiModelProperty("学期")
    private String term;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '备注'")
    @ApiModelProperty("备注")
    private String remark;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '脚注'", nullable = false)
    @ApiModelProperty("脚注")
    private String footnote;

    @UpdateTimestamp
    @Column(columnDefinition="DATETIME COMMENT '最后更新时间'")
    @ApiModelProperty("最后更新时间")
    private Date modifyTime;

    @Column(columnDefinition = "INT COMMENT '支付状态0:未付款; 1:已付款, 2:支付中'")
    @ApiModelProperty("支付状态0:未付款; 1:已付款, 2:支付中")
    private Integer payStatus = 0;

    @Column(columnDefinition = "VARCHAR(16) COMMENT '实付类型:alipay,wechat'")
    @ApiModelProperty("实付类型")
    private String payType;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '支付成功时间'")
    @ApiModelProperty("支付成功时间")
    private Date paiedTime;

    @Column(columnDefinition = "INT COMMENT '总金额'")
    @ApiModelProperty("总金额")
    private Integer totalAmount;

    @Transient
    private ContractVo contract;
}
